#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QCloseEvent>
#include "SARibbon.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public SARibbonMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_actionExit_triggered();
    void on_actionPoint_triggered();
    void on_actionLine_triggered();
    void on_actionPolyLine_triggered();
    void on_actionCircle_triggered();
    void on_actionEllipse_triggered();
    void on_actionRect_triggered();
    void on_actionSelect_triggered();
    void on_actionMove_triggered();
    void on_actionDelete_triggered();
    void onActionHelpTriggered();
    //void on_actionList_triggered();
    void on_ActionColor_triggered(const QColor& c);
    void on_ActionPenStyle_triggered(int index);

private:
    Ui::MainWindow *ui;

    QGraphicsScene *m_scene = nullptr;
    QLineEdit* mLineWidthEditor { nullptr };

private:
    // 创建ribbon-application菜单
    void createRibbonApplicationButton();
    // 创建Draw菜单
    void createCategoryDraw(SARibbonCategory* page);
    void createCategoryModify(SARibbonCategory* page);
    // 创建右上角系统最大、最小化按钮栏的图标工具
    void createWindowButtonGroupBar();
    // 创建左上角快捷方式
    void createQuickAccessBar();
    // 创建ActionsManager，实现actions的管理以及SARibbonBar的自定义
    void createActionsManager();
    QAction* createAction(const QString& text, const QString& iconurl, const QString& objName, const bool& textOn = true);
    QAction* createAction(const QString& text, const QString& iconurl, const bool& textOn = true);

private:
    // 创建其它actions，这些actions并不在SARibbonBar管理
    void createOtherActions();

protected:
    // QCloseEvent事件
    void closeEvent(QCloseEvent* e) override;

private:
    QMenu* mMenuApplicationBtn;
    SARibbonActionsManager* mActionsManager;
    int mTagForActionText;
    int mTagForActionIcon;
};
#endif // MAINWINDOW_H
